import { useEnv } from '@/utils/env'
import service from '@/utils/request'

const { VITE_BASE_URL, VITE_VIDEO_URL } = useEnv()

/**
 * @description 选择通道
 * @param params
 * @returns
 */
export const useVideoChannelApi = (params: any) => {
	return service.get(VITE_VIDEO_URL + '/turnControl/getAnotherNum', { params })
}

// 预置位
/**
 * @description 预置位-列表
 * @param params
 * @returns
 */
export const useTurnPresetListApi = (params: any) => {
	return service.get(VITE_VIDEO_URL + '/livegbs/control/getPreset', { params })
}

/**
 * @description 预置位-调用
 * @param params
 * @returns
 */
export const useTurnPresetPositionApi = (params: any) => {
	return service.get(VITE_VIDEO_URL + '/livegbs/control/preset', { params })
}

/**
 * @description 预置位-设置
 * @param params
 * @returns
 */
export const useTurnPresetSetApi = (data: any) => {
	return service.post(VITE_VIDEO_URL + '/control/setPreset', data)
}

/**
 * @description 预置位-删除
 * @param params
 * @returns
 */
export const useTurnPresetDelApi = (data: any) => {
	return service.post(VITE_VIDEO_URL + '/control/clearPreset', data)
}

/**
 * @description 预置位-定位
 * @param params
 * @returns
 */
export const useTurnPresetPtzPositionApi = (data: any) => {
	return service.post(VITE_VIDEO_URL + '/turn-preset/ptzPosition', data)
}

// 扇扫
/**
 * @description 扇扫-获取
 * @param params
 * @returns
 */
export const useGetTurnScanApi = (params: any) => {
	return service.get(VITE_VIDEO_URL + '/turnScan/getScanParam', { params })
}

/**
 * @description 扇扫-保存
 * @param params
 * @returns
 */
export const useSaveTurnScanApi = (data: any) => {
	return service.post(VITE_VIDEO_URL + '/turnScan/setScanParam', data)
}

/**
 * @description 扇扫 0=开始,1=结束,2=暂停,3=继续
 * @param params
 * @returns
 */
export const useRunTurnScanApi = (data: any) => {
	return service.post(VITE_VIDEO_URL + '/turnScan/controlScan', data)
}

/**
 * @description 参数-获取
 * @param params
 * @returns
 */
export const useGetVisibleCfgApi = (params: any) => {
	return service.get(VITE_VIDEO_URL + '/vpControl/visibleCfg', { params })
}

/**
 * @description 参数-保存
 * @param params
 * @returns
 */
export const useSaveVisibleCfgApi = (data: any) => {
	return service.post(VITE_VIDEO_URL + '/vpControl/visibleCfg', data)
}

/**
 * @description 码流-获取
 * @param params
 * @returns
 */
export const useGetVideoCfgApi = (params: any) => {
	return service.get(VITE_VIDEO_URL + '/vpControl/getVideoCfg', { params })
}

/**
 * @description 码流-保存
 * @param params
 * @returns
 */
export const useSaveVideoCfgApi = (data: any) => {
	return service.post(VITE_VIDEO_URL + '/vpControl/setVideoCfg', data)
}

/**
 * @description 巡航-获取
 * @param params
 * @returns
 */
export const useGetTurnCruiseListApi = (params: any) => {
	return service.get(VITE_VIDEO_URL + '/control/getCruiseRoutes', { params })
}

/**
 * @description 巡航-运行 0=开始, 1=结束, 2=暂停
 * @param params
 * @returns
 */
// 巡航-运行 开始
export const useRunTurnCruiseApi = (params: any) => {
	return service.get(VITE_VIDEO_URL + '/control/runCruise', { params })
}
// 巡航-运行 结束
export const useStopTurnCruiseApi = (params: any) => {
	return service.get(VITE_VIDEO_URL + '/control/stopCruise', { params })
}


/**
 * @description 巡航-删除
 * @param params
 * @returns
 */
export const useDelTurnCruiseApi = (data: any) => {
	return service.post(VITE_VIDEO_URL + '/control/deletePresetFromCruise', data)
}

/**
 * @description 巡航-设置巡航路径信息
 * @param params
 * @returns
 */
export const useSetTurnCruiseApi = (data: any) => {
	return service.post(VITE_VIDEO_URL + '/control/setCruise', data)
}

/**
 * @description 巡航-获取守望参数
 * @param params
 * @returns
 */
export const useModeGetTurnCruiseApi = (params: any) => {
	return service.get(VITE_VIDEO_URL + '/turnCruise/homeModeGet', { params })
}

/**
 * @description 巡航-设置守望参数
 * @param params
 * @returns
 */
export const useModeSetTurnCruiseApi = (data: any) => {
	return service.post(VITE_VIDEO_URL + '/turnCruise/homeModeSet', data)
}

/**
 * @description 转台控制-获取转台速度和聚焦速度
 * @param params
 * @returns
 */
export const useGetCtrlSpeedApi = (params: any) => {
	return service.get(VITE_BASE_URL + '/data/settingModule/turn-control/getCtrlSpeed.json', { params })
	return service.get(VITE_VIDEO_URL + '/turnControl/getCtrlSpeed', { params })
}

/**
 * @description 转台控制-方位控制
 * @param params
 * @returns
 */
export const usePstControlApi = (params: any) => {
	return service.get(VITE_VIDEO_URL + '/livegbs/control/ptz', {
		params,
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
		}
	})
}

/**
 * @description 转台控制-变倍|聚焦|光圈
 * @param params
 * @returns
 */
export const useZfaControlApi = (params: any) => {
	return service.get(VITE_VIDEO_URL + '/livegbs/control/focusIris', {
		params,
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
		}
	})
}

/**
 * @description 转台控制-云台水平速度|聚焦速度
 * @param params
 * @returns
 */
export const useSetCtrlSpeedApi = (data: any) => {
	// return service.post(VITE_BASE_URL + '/data/success.json', data)
	return service.post(VITE_VIDEO_URL + '/turnControl/setCtrlSpeed', data)
}

/**
 * @description 船舶图像识别
 * @param data
 * @returns
 */
export const useControlShipImgRec = (data: any) => {
	return service.post(VITE_VIDEO_URL + '/control/shipImgRec', data)
}
